<template>
<!-- #ifdef APP-PLUS -->
<cell>
<!-- #endif -->
<view class="list-card padding-all detail-white sec-top">
	<image class="list-card-cover border-radius"
		:src="item.user && item.user.avatar"
		mode="aspectFill"
		@click="onItemClick('profile')" />
	<view class="list-card-content sec-left"
		@click="onItemClick('detail')">
		<view class="list-card-header">
			<view class="list-card-title">{{ item.user && item.user.nickname }}</view>
			<view class="list-card-time">{{ item.lastPostTime }}</view>
		</view>
		<view class="list-card-body">
			<rich-text :nodes="item.content"></rich-text>
		</view>
		<view class="list-card-footer">
			<view class="list-action-item"
				@click.stop="onItemClick('forward')">
				<text class="iconfont icon-forward"></text>
				<text class="sec-left">{{ item.forwardNum }}</text>
			</view>
			<view class="list-action-item"
				@click.stop="onItemClick('comment')">
				<text class="iconfont icon-comment"></text>
				<text class="sec-left">{{ item.postNum }}</text>
			</view>
			<view class="list-action-item"
				@click.stop="onItemClick('collect')">
				<text class="iconfont icon-collect"></text>
				<text class="sec-left">{{ item.hitNum }}</text>
			</view>
			<view class="list-action-item"
				@click.stop="onItemClick('help')">
				<text class="iconfont icon-help"></text>
				<text class="sec-left">{{ item.askNum }}</text>
			</view>
		</view>
		<view class="list-card-slot">
			<view class="list-slot-item"
				v-for="citem in item.posts"
				:key="citem.id">
				<block v-if="citem.toPostUserName">
					<text class="list-slot-name">{{ citem.postUserName }}</text>
					<text class="sec-left">回复</text>
					<text class="list-slot-name sec-left">{{ citem.toPostUserName }}</text>:
					<text class="sec-left">{{ citem.content }}</text>
				</block>
				<block v-else>
					<text class="list-slot-name">{{ citem.postUserName }}</text>:
					<text class="sec-left">{{ citem.content }}</text>
				</block>
			</view>
		</view>
	</view>
</view>
<!-- #ifdef APP-PLUS -->
</cell>
<!-- #endif -->
</template>

<script>
export default {
	props: {
		item: {
			type: Object,
			default: () => {}
		}
	},
	methods: {
		onItemClick(type) {
			this.$emit('on-item', type);
		}
	}
}
</script>
